@extends('backend::layout')
@section('title',trans($page_title))
@section('content')
    @component('backend::component.table.table-content')
        @slot('page_title') {{$page_title}} @endslot
        @slot('tools_btn')
            @component('backend::component.form.button')
                @slot('title') 添加商品 @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('color') info @endslot
                @slot('icon') hcl-goods-add1 @endslot
                @slot('href') {{route('b_ShopGoods_create')}} @endslot
            @endcomponent
            @component('backend::component.form.button')
                @slot('title') 批量删除 @endslot
                @slot('btn') btn @endslot
                @slot('color') danger @endslot
                @slot('icon') hcl-remove @endslot
                @slot('class') btn-ajax @endslot
                @slot('params')
                    {"url":"{{route('b_ShopBrand_batchDelete')}}","method":"post","title":"批量删除品牌","targetData":".id","confirm":"true"}
                @endslot
            @endcomponent
        @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <table class="list table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            @component('backend::component.checkbox')
                                @slot('name') ids-all @endslot
                            @endcomponent
                        </th>
                        <th>商品图片</th><th>商品名称</th><th>价格</th><th>标签</th><th>排序</th>
                        <th>销量</th><th>SKU库存</th><th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $value)
                        <tr>
                            <td>
                                @component('backend::component.checkbox')
                                    @slot('name') ids[] @endslot
                                    @slot('class') id @endslot
                                    @slot('value') {{$value->id}} @endslot
                                @endcomponent
                            </td>
                            <td>
                                @php
                                   $goods_img = str2arr($value->goods_images)
                                @endphp
                                <img src="{{$goods_img[0]}}" style="height: 40px;" />
                            </td>
                            <td>{{$value->goods_name}}</td>
                            <td>
                                售价:{{$value->price}}<br/>
                                成本:{{$value->cost_price}}
                            </td>
                            <td>
                                <div class="d-flex flex-row mb-1">
                                    <span class="align-self-center mr-1" style="min-width: 40px;">新品:</span>
                                    @component("backend::component.switch")
                                        @slot('params')
                                            {"url":"{{route('b_ShopGoods_switchLabelState',['id'=>$value->goods_id,'label'=>'new'])}}"}
                                        @endslot
                                        @slot('checked') @if($value->is_new == 1) checked @endif @endslot
                                    @endcomponent
                                </div>
                                <div class="d-flex flex-row mb-1">
                                    <span class="align-self-center mr-1" style="min-width: 40px;">热销:</span>
                                    @component("backend::component.switch")
                                        @slot('params')
                                            {"url":"{{route('b_ShopGoods_switchLabelState',['id'=>$value->goods_id,'label'=>'hot'])}}"}
                                        @endslot
                                        @slot('checked') @if($value->is_hot == 1) checked @endif @endslot
                                    @endcomponent
                                </div>
                                <div class="d-flex flex-row">
                                    <span class="align-self-center mr-1" style="min-width: 40px;">推荐:</span>
                                    @component("backend::component.switch")
                                        @slot('params')
                                            {"url":"{{route('b_ShopGoods_switchLabelState',['id'=>$value->goods_id,'label'=>'recommend'])}}"}
                                        @endslot
                                        @slot('checked') @if($value->is_recommend == 1) checked @endif @endslot
                                    @endcomponent
                                </div>

                            </td>
                            <td>{{$value->sort}}</td>
                            <td>
                                实际销量:{{$value->fact_sales_volume}}<br/>
                                显示销量:{{$value->show_sales_volume}}
                            </td>
                            <td><a class="font-weight-bold" ><i style="font-size: 1.5rem;color:gray;" class="hcl hcl-edit1"></i></a></td>
                            <td>
                                @component('backend::component.form.button')
                                    @slot('title') 删除 @endslot
                                    @slot('icon') hcl-remove @endslot
                                    @slot('color') danger @endslot
                                    @slot('params') {"url":"{{route('b_ShopBrand_delete',['id'=>$value->id])}}","confirm":"true"} @endslot
                                    @slot('class') btn-ajax @endslot
                                @endcomponent

                                @component('backend::component.form.button')
                                    @slot('title') 上架 @endslot
                                    @slot('icon') hcl-xiajia @endslot
                                    @slot('color') danger @endslot
                                    @slot('params') {"url":"{{route('b_ShopGoods_foreverDown',['id'=>$value->goods_id])}}","confirm":"true"} @endslot
                                    @slot('class') btn-ajax @endslot
                                @endcomponent

                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            @else
                @component('backend::public.empty_page')
                    @slot('info') 暂时没有商品 @endslot
                @endcomponent
            @endif
        @endslot
    @endcomponent
@endsection